package com.share.netdisk.user.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;

import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

@Data
@TableName("user")
@Schema(name = "用户表", description = "User对象")
public class User{
    @TableId(value="user_id", type = IdType.AUTO)
    @Schema(title = "用户ID",example = "1",accessMode = Schema.AccessMode.READ_ONLY)
    private Long id;

    @Pattern(regexp = "^[a-zA-Z0-9_-]{4,16}$",message = "用户名必须为4-16位的字母、数字、下划线或横线组成")
    @Schema(title = "用户名",example = "admin",required = true)
    private String username;

    @Pattern(regexp = "^[a-zA-Z0-9_-]{6,16}$",message = "密码必须为6-16位的字母、数字、下划线或横线组成")
    private String password;

    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$",message = "手机号格式错误")
    private String phone;

    private String photoUrl;

    @Schema(hidden = true)
    private Integer status;


    public User (String username, String password,String phone){
        this.username = username;
        this.password = password;
        this.phone = phone;
    }
    public User (){}
}
